<?php

namespace api\behavior;

use think\Config;
use think\Request;

class Behavior
{
    public function app_init(&$params)
    {
        if (Request::instance()->ext() == 'json') {
            Config::set('url_controller_layer', 'api');
            Config::set('default_return_type', 'json');
            Config::set('exception_handle', 'api\\exception\\JsonException');
        }
        if (!empty($_SERVER['HTTP_ACCESS'])) {
            $_REQUEST[Config::get('session.var_session_id')] = $_SERVER['HTTP_ACCESS'];
        }
    }

    public function action_begin(&$params)
    {

    }
}